package com.yanqu.road.entity.activity.sonhai.enums;

import java.util.ArrayList;
import java.util.List;

public enum SonHaiPlotTypeEnum {

    PLOT_TYPE_1(1, "兽王", SonHaiPlotBattleTypeEnum.PLOT_BATTLE_TYPE_BOSS.getType()),
    PLOT_TYPE_2(2, "兽群", SonHaiPlotBattleTypeEnum.PLOT_BATTLE_TYPE_NORMAL.getType()),
    PLOT_TYPE_3(3, "灵草田", SonHaiPlotBattleTypeEnum.PLOT_BATTLE_TYPE_NORMAL.getType()),
    PLOT_TYPE_4(4, "灵矿", SonHaiPlotBattleTypeEnum.PLOT_BATTLE_TYPE_NORMAL.getType()),
    PLOT_TYPE_5(5, "钦原巢", SonHaiPlotBattleTypeEnum.PLOT_BATTLE_TYPE_NORMAL.getType()),
    PLOT_TYPE_6(6, "瑶碧丘（狰巢）", SonHaiPlotBattleTypeEnum.PLOT_BATTLE_TYPE_NORMAL.getType()),
    PLOT_TYPE_7(7, "朱厌巢", SonHaiPlotBattleTypeEnum.PLOT_BATTLE_TYPE_NORMAL.getType()),
    PLOT_TYPE_8(8, "沙漠", SonHaiPlotBattleTypeEnum.PLOT_BATTLE_TYPE_NORMAL.getType()),
    PLOT_TYPE_9(9, "鹊山", SonHaiPlotBattleTypeEnum.PLOT_BATTLE_TYPE_NULL.getType()),
    PLOT_TYPE_10(10, "当康巢", SonHaiPlotBattleTypeEnum.PLOT_BATTLE_TYPE_NULL.getType()),
    PLOT_TYPE_11(11, "令丘山", SonHaiPlotBattleTypeEnum.PLOT_BATTLE_TYPE_NULL.getType()),
    PLOT_TYPE_12(12, "嘉果树", SonHaiPlotBattleTypeEnum.PLOT_BATTLE_TYPE_NULL.getType()),
    PLOT_TYPE_13(13, "异兽栖-PVP抢蛋", SonHaiPlotBattleTypeEnum.PLOT_BATTLE_TYPE_EGG.getType()),
    PLOT_TYPE_14(14, "营地-PVP", SonHaiPlotBattleTypeEnum.PLOT_BATTLE_TYPE_NORMAL.getType()),
    PLOT_TYPE_15(15, "山海商队", SonHaiPlotBattleTypeEnum.PLOT_BATTLE_TYPE_NULL.getType()),
    PLOT_TYPE_16(16, "2选1", SonHaiPlotBattleTypeEnum.PLOT_BATTLE_TYPE_NULL.getType()),
    ;

    /**
     * 类型
     */
    private int type;

    /**
     * 名称
     */
    private String name;

    /**
     * 战斗类型。1：普通战斗，2：兽王战斗，3：蛋蛋战斗
     */
    private int battleType;

    SonHaiPlotTypeEnum(int type, String name, int battleType) {
        this.type = type;
        this.name = name;
        this.battleType = battleType;
    }

    public int getType() {
        return type;
    }

    public String getName() {
        return name;
    }

    public int getBattleType() {
        return battleType;
    }

    /**
     * 判断地块类型是否是【不能自动镇伏的地块类型】
     * @param type
     * @return
     */
    public static boolean checkNotAutoWinType(int type) {
        //兽王，PVP抢蛋，PVP打架 不能自动镇伏
        if (type == PLOT_TYPE_1.getType() || type == PLOT_TYPE_13.getType() || type == PLOT_TYPE_14.getType()) {
            return true;
        }
        return false;
    }

    /**
     * 获取地块类型LIST.根据地块战斗类型
     * @param battleTypeEnum
     * @return
     */
    public static List<SonHaiPlotTypeEnum> getTypesByBattleType(SonHaiPlotBattleTypeEnum battleTypeEnum) {
        List<SonHaiPlotTypeEnum> enumList = new ArrayList<>();
        for (SonHaiPlotTypeEnum typeEnum : SonHaiPlotTypeEnum.values()) {
            if (typeEnum.getBattleType() == battleTypeEnum.getType()) {
                enumList.add(typeEnum);
            }
        }
        return enumList;
    }
}
